package packge.obj;

class Address {
	int aid;
	String Street;
	int pin;

	Address(int aid, String Street, int pin) {
		this.aid = aid;
		this.Street = Street;
		this.pin = pin;
	}

	public String toString() {
		return aid + "\t" + Street + "\t" + pin;
	}
}

class Student implements Cloneable {
	int id;
	String name;
	long phone;
	String email;
	double fee;
	Address add;

	Student(int id, String name, long phone, String email, double fee, Address add) {
		this.id = id;
		this.name = name;
		this.phone = phone;
		this.email = email;
		this.fee = fee;
		this.add = add;
		System.out.println("-------Student     Cons--------");
	}

	public Object clone() throws CloneNotSupportedException {
		Object obj = null;
		obj = super.clone();
		return obj;
	}
}

class ObTest4 {
	public static void main(String str[]) throws Exception {
		Address add1 = new Address(99, "Madiwala", 560068);
		Student st = new Student(104, "Sri", 8382738, "sri@jlc.com", 16000.0, add1);
		Student st3 = (Student)st.clone();
		System.out.println("** After cloning the object **");
		System.out.println(st3);
		System.out.println(st.add == st3.add);
		System.out.println("** After modifying the  clone object **");
		st3.id = 8;
		st3.name = "manish";
		st3.phone = 98765545L;
		st3.email = "gaurav@jlc.com";
		st3.fee = 8000.0;
		st3.add.aid = 8766;
		st3.add.Street = "Hosur main Road";
		st3.add.pin = 560028;
		System.out.println(st);
		System.out.println(st3);
	}
}